package cn.cvs.service.impl;

import cn.cvs.dao.SysUserDao;
import cn.cvs.pojo.SysUser;
import cn.cvs.service.SysUserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SysUserServiceImpl implements SysUserService {

    @Autowired
    private SysUserDao sysUserDao;

    @Override
    public SysUser findSys(String account, String password) {
        return sysUserDao.findSys(account,password);
    }



    @Override
    public List<SysUser> findSysUser(String account, Integer roleId, Integer pageIndex, Integer pageSize) {
        return sysUserDao.findSysUser(account,roleId,(pageIndex -1) * pageSize ,pageSize);
    }



    @Override
    public Integer getUserCount(String account, Integer roleId) {

        return sysUserDao.getUserCount(account ,roleId);
    }

    @Override
    public int getByAccount(String account) {
        return sysUserDao.getByAccount(account);
    }

    @Override
    public int addSysUser(SysUser sysUser) {
        return sysUserDao.addSysUser(sysUser);
    }

    @Override
    public int delSysUser(Integer id) {
        return sysUserDao.delSysUser(id);
    }

    @Override
    public int updateSysUser(SysUser sysUser) {
        return sysUserDao.updateSysUser(sysUser);
    }

    @Override
    public SysUser getBySysUserId(Integer id) {
        return sysUserDao.getBySysUserId(id);
    }

    @Override
    public int savePassword(String password, Integer id) {
        return sysUserDao.savePassword(password,id);
    }


}
